<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-frontend',
    'timeZone' => 'asia/shanghai',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'language' => 'zh-CN',
    'controllerNamespace' => 'frontend\controllers',
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
            'enableCsrfValidation' => false,
          ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the frontend
            'name' => 'advanced-frontend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        //'wechat' => function(){
        //    $options = [
        //        'token'=>'xagkwl2gheddetvnwmwuvav2rqh0islw', //填写你设定的key
        //        'appid'=>'wx64feb62046650f3c', //填写高级调用功能的app id, 请在微信开发模式后台查询
        //        'appsecret'=>'9274d9aa72c9bc19661ea61d1f15123e', //填写高级调用功能的密钥
        //        'encodingaeskey' => 'wR89SdZRipaPacA2q2Zt8zZ186C7d29jRa7dZrRJ7RR'
        //    ];
        //    return new dodgepudding\wechat\sdk\Wechat($options);
        //},
        'wechat' => function(){
            $options = [
                'appid'=>'wx94eff3db03269f2d', //填写高级调用功能的app id, 请在微信开发模式后台查询
                'appsecret'=>'109cce073ec9e2810712c685e263f999', //填写高级调用功能的密钥
            ];
            return new dodgepudding\wechat\sdk\Wechat($options);
        },
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
            ],
        ],
    ],
    'params' => $params,
];
